﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.Drawing;

namespace Smallerp.Contracts.DataContracts
{
    [DataContract]
    public class PhotoInfo_PBDCT
    {
        //public event BarCodeStatusChanged BarCodeStatusChangedEvent;

        public PhotoInfo_PBDCT()
        {
            PBNum = 0;
            Photo_Base_Info = new PhotoDCT();
        }
        [DataMember]
        public PhotoDCT Photo_Base_Info { get; set; }

        //public float Height_CM { get; }


        //public float Width_CM { get; }
        [DataMember]
        public int OrderProductId
        {
            get
            {
                return Photo_Base_Info.OrderProductId;
            }
            set { }
        }



        /// <summary>
        /// 图片的条码信息0-条码在图片的左边或是右边，1-条码在图片的上面或是下面，2-无条码
        /// </summary>
        /// 
        private SmallERP.COM.Status.PhotoBarCodeStatus _barCodeStatus;
        [DataMember]
        public SmallERP.COM.Status.PhotoBarCodeStatus BarCodeStatus
        {
            get { return _barCodeStatus; }
            set
            {
                _barCodeStatus = value;
            }
        }
        [DataMember]
        public int PhotoNum { get { return Photo_Base_Info.TotalNum; } set { } }
        [DataMember]
        public string PhotoName { get { return Photo_Base_Info.PhotoName; } set { } }
        [DataMember]
        public string PicPath { get { return Photo_Base_Info.PicPath; } set { } }
        [DataMember]
        public int TotalNum { get { return Photo_Base_Info.TotalNum; } set { } }
        [DataMember]
        public int PBNum { get; set; }
        [DataMember]
        public int PhotoId { get { return Photo_Base_Info.PhotoId; } set { } }



        [DataMember]
        public int PhotoIds { get; set; }

        [DataMember]
        public string PhotoNames { get; set; }

        [DataMember]
        public int OrderProductIds { get; set; }

        [DataMember]
        public string PicPaths { get; set; }

        

        /// <summary>
        /// 是否已自动拼板过
        /// </summary>
        [DataMember]
        public bool IsAutoPB { get; set; }
        [DataMember]
        public Point Location { get; set; }
        /// <summary>
        /// 是否旋转
        /// </summary>
        [DataMember]
        public bool IsWhirl { get; set; }
        /// <summary>
        /// 是否被托到大板上
        /// </summary>
        [DataMember]
        public bool IsInBoard { get; set; }

        /// <summary>
        /// 纸面
        /// </summary>
        [DataMember]
        public string PaperFaceName { get; set; }
        /// <summary>
        /// 纸型
        /// </summary>
        [DataMember]
        public string PaperTypeName { get; set; }
        /// <summary>
        /// 产品定单名称
        /// </summary>
        [DataMember]
        public string OrderName { get; set; }
        /// <summary>
        /// 照片尺寸 23x34(in)(XX)(CM)
        /// </summary>
        [DataMember]
        public string PhotoSize
        {
            get
            {
                if (Photo_Base_Info.Width >= Photo_Base_Info.Height)
                {
                    return Photo_Base_Info.Width.ToString("0.00") + "X" +
                    Photo_Base_Info.Height.ToString("0.00");
                }
                else
                {
                    return Photo_Base_Info.Height.ToString("0.00") + "X" +
                    Photo_Base_Info.Width.ToString("0.00");
                }
            }
            set { }
        }
        [DataMember]
        public string PhotoSizeCm
        {
            get
            {
                if (Photo_Base_Info.Width >= Photo_Base_Info.Height)
                {
                    return (Photo_Base_Info.Width * 2.54).ToString("0.00") + "X" +
                    (Photo_Base_Info.Height * 2.54).ToString("0.00");
                }
                else
                {
                    return (Photo_Base_Info.Height * 2.54).ToString("0.00") + "X" +
                                      (Photo_Base_Info.Width * 2.54).ToString("0.00");
                }
            }
            set { }
        }
        /// <summary>
        /// 照片所对应的产品的加急级别
        /// </summary>

        [DataMember]
        public int Priority { get; set; }

        [DataMember]
        public Size PSize { get { return new Size(Photo_Base_Info.PixWidth, Photo_Base_Info.PixHeight); } set { } }
        [DataMember]
        public bool IsCopy { get; set; }
        [DataMember]
        public int TryTime { get; set; }
        [DataMember]
        public int PixHeight { get { return Photo_Base_Info.PixFactHeigth; } set { ; } }
        /// <summary>
        /// 实际照片宽度
        /// </summary>
        [DataMember]
        public string PhotoSizePix
        {
            get
            {
                return Photo_Base_Info.PixFactWidth.ToString() + "X" +
                Photo_Base_Info.PixFactHeigth.ToString();
            }
            set { }
        }
        //[DataMember]
        //public int ColorType { get; set; }
        [DataMember]
        public int OrderPhotosCount { get; set; }

        [DataMember]
        public int OrderPhotosInboardCount { get; set; }

        [DataMember]
        public decimal CompletePercent { get {

            if (OrderPhotosCount == 0 || OrderPhotosInboardCount == 0)
            {
                return 0;
            }
            else
            {
                return (decimal)OrderPhotosInboardCount / OrderPhotosCount;
            }
        }
            set { }
        }
        [DataMember]
        public string PhotoSizeAll { get { return this.PhotoSize + "(" + this.PhotoSizeCm + ")"; } set { ;} }
    }
}
